<template>
  <div>
    <div v-if="businessType != 16">
      <span style="margin-left:100px">综合评估</span>
      <span style="margin-left:30px">{{ returntext.comEvaluation }}</span>
    </div>
    <div v-if="businessType == 16">
      <div>
        <span style="margin-left:100px">结案时间</span>
        <span style="margin-left:30px">{{ returntext.createTime }}</span>
      </div>
      <div>
        <span style="margin-left:100px">结案类型</span>
        <span style="margin-left:30px" v-if="returntext.caseType != 0">{{
          caseTypeArr[returntext.caseType - 1].text
        }}</span>
        <span style="margin-left:30px" v-if="returntext.caseType == 0">全部</span>
      </div>
      <div>
        <span style="margin-left:100px">证明材料</span>
        <span style="margin-left:30px;color:#1890FF"><j-upload v-model="returntext.prove"></j-upload></span>
      </div>
      <div>
        <span style="margin-left:58px">社工总结及反思</span>
        <span style="margin-left:30px">{{ returntext.reflect }}</span>
      </div>
    </div>
  </div>
</template>

<script>
import { getDictItemsFromCache } from '@/api/api'
export default {
  props: {
    businessType: {
      type: [String, Number],
      required: true
    },
    jsonParam: {

    }
  },
  data() {
    return {
      returntext: '',
      caseTypeArr: getDictItemsFromCache('closing_type'),
    }
  },
  beforeMount() {
    // console.log(this.caseTypeArr);
    this.returntext = {
      comEvaluation: '',
      caseType: 5,
      prove: '',
      reflect: ''
    }
  },
  watch: {
    jsonParam: {
      immediate: true,
      deep: true,
      handler(val) {
        this.returntext = val
        // this.returntext.prove = this.returntext.prove.replace("temp/","")
        if (this.returntext.createTime) {
          this.returntext.createTime = this.timestampToTime(this.returntext.createTime)
        }
        // console.log(this.returntext);
      }
    }
  },
  mounted() {
  },
  methods: {
    timestampToTime(timestamp) {
      if (timestamp === 0 || timestamp == null) {
        return ''
      }
      else {
        var date = new Date(Date.parse(timestamp))
        var Y = date.getFullYear() + '-'
        var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
        var D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
        return Y + M + D
      }
    },
  }
}
</script>
<style lang="less" scoped>
/deep/.ant-upload {
  display: none;
}

/deep/.ant-upload-list {
  position: absolute;
  top: -30px;
  left: 159px;

  i {
    display: none;
  }
}
</style>